%% test
out = q-a;
in = zeros(size(l));
test = in;
in(2:end,2:end) = out(1:end-1,:);
inall = in;
inall(:,1:2) = inall(:,1:2) + q;
inall(2:end,2) = inall(2:end,2) + a(1:end-1,1);
net = inall - [out zeros(length(inall),1)];
%test = 